﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// This is the abstract edit form for the <see cref="Entities.Mjesto"/> entity.
	/// </summary>
	/// <remarks>This class is overwritten by .netTiers at each generation.</remarks>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class MjestoEditControlBase : System.Windows.Forms.UserControl
	{
		#region Fields
		
		//private System.Windows.Forms.TableLayoutPanel uxTableLayoutPanel;
		/// <summary>
		/// The ErrorProvider for the Entity;
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxErrorProvider;
		
		/// <summary>
		/// The BindingSource for the entity.
		///</summary>
		protected System.Windows.Forms.BindingSource uxBindingSource;
						
		
		/// <summary>
		/// TextBox for the ID property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxID;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the ID property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDLabel;
		
		/// <summary>
		/// TextBox for the Naziv property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxNaziv;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Naziv property.
		/// </summary>
		protected System.Windows.Forms.Label uxNazivLabel;
		
		/// <summary>
		/// TextBox for the PostanskiBroj property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxPostanskiBroj;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the PostanskiBroj property.
		/// </summary>
		protected System.Windows.Forms.Label uxPostanskiBrojLabel;
		
		/// <summary>
		/// TextBox for the SifraOpcine property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxSifraOpcine;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the SifraOpcine property.
		/// </summary>
		protected System.Windows.Forms.Label uxSifraOpcineLabel;
		
		/// <summary>
		/// TextBox for the Prirez property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxPrirez;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Prirez property.
		/// </summary>
		protected System.Windows.Forms.Label uxPrirezLabel;
		
		/// <summary>
		/// TextBox for the ZiroRacunZaPorezPrirez property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxZiroRacunZaPorezPrirez;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the ZiroRacunZaPorezPrirez property.
		/// </summary>
		protected System.Windows.Forms.Label uxZiroRacunZaPorezPrirezLabel;
		
		/// <summary>
		/// ComboBox for the TipMjesta property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxTipMjesta;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the TipMjesta property.
		/// </summary>
		protected System.Windows.Forms.Label uxTipMjestaLabel;
		
		/// <summary>
		/// ComboBox for the IDNadMjesto property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxIDNadMjesto;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IDNadMjesto property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDNadMjestoLabel;
		
		/// <summary>
		/// TextBox for the Hierarchy property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxHierarchy;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Hierarchy property.
		/// </summary>
		protected System.Windows.Forms.Label uxHierarchyLabel;
		
		/// <summary>
		/// TextBox for the Lvl property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxLvl;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Lvl property.
		/// </summary>
		protected System.Windows.Forms.Label uxLvlLabel;
		
		/// <summary>
		/// TextBox for the SifraOpcineRegos property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxSifraOpcineRegos;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the SifraOpcineRegos property.
		/// </summary>
		protected System.Windows.Forms.Label uxSifraOpcineRegosLabel;
		#endregion
		
		#region Main entity
		private Entities.Mjesto _Mjesto;
		/// <summary>
		/// Gets or sets the <see cref="Entities.Mjesto"/> entity to edit with this form.
		/// </summary>
		/// <value>The <see cref="Entities.Mjesto"/> instance.</value>
		public Entities.Mjesto Mjesto
		{
			get {return this._Mjesto;}
			set
			{
				this._Mjesto = value;
				if (value != null) 
				{
					this.uxBindingSource.DataSource = value;
					BindControls();
				}			
				
			}
		}
		#endregion
		
		/// <summary>
		/// Binds the controls.
		/// </summary>
		private void BindControls()
		{
			this.uxID.DataBindings.Clear();
			this.uxID.DataBindings.Add("Text", this.uxBindingSource, "ID", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxNaziv.DataBindings.Clear();
			this.uxNaziv.DataBindings.Add("Text", this.uxBindingSource, "Naziv", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxPostanskiBroj.DataBindings.Clear();
			this.uxPostanskiBroj.DataBindings.Add("Text", this.uxBindingSource, "PostanskiBroj", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxSifraOpcine.DataBindings.Clear();
			this.uxSifraOpcine.DataBindings.Add("Text", this.uxBindingSource, "SifraOpcine", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxPrirez.DataBindings.Clear();
			this.uxPrirez.DataBindings.Add("Text", this.uxBindingSource, "Prirez", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxZiroRacunZaPorezPrirez.DataBindings.Clear();
			this.uxZiroRacunZaPorezPrirez.DataBindings.Add("Text", this.uxBindingSource, "ZiroRacunZaPorezPrirez", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxTipMjesta.DataBindings.Clear();
			this.uxTipMjesta.DataBindings.Add("SelectedValue", this.uxBindingSource, "TipMjesta", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxIDNadMjesto.DataBindings.Clear();
			this.uxIDNadMjesto.DataBindings.Add("SelectedValue", this.uxBindingSource, "IDNadMjesto", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxHierarchy.DataBindings.Clear();
			this.uxHierarchy.DataBindings.Add("Text", this.uxBindingSource, "Hierarchy", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxLvl.DataBindings.Clear();
			this.uxLvl.DataBindings.Add("Text", this.uxBindingSource, "Lvl", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxSifraOpcineRegos.DataBindings.Clear();
			this.uxSifraOpcineRegos.DataBindings.Add("Text", this.uxBindingSource, "SifraOpcineRegos", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
		}					
		
		#region Constructor
		
		/// <summary>
		/// Initializes a new instance of the <see cref="MjestoEditControlBase"/> class.
		/// </summary>
		public MjestoEditControlBase()
		{
			InitializeComponent();			
			
			this.uxBindingSource.CurrentItemChanged += new System.EventHandler(uxBindingSource_currentItemChanged);
		}		
		
		/// <summary>
		/// 
		/// </summary>
		private void uxBindingSource_currentItemChanged(object sender, System.EventArgs e)
		{
			if (_Mjesto != null) _Mjesto.Validate();
		}	
				
		/// <summary>
		/// Initializes the component.
		/// </summary>
		public void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.uxErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxBindingSource = new System.Windows.Forms.BindingSource(this.components);
			
			//this.uxTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
			this.uxID = new System.Windows.Forms.TextBox();
			uxIDLabel = new System.Windows.Forms.Label();
			this.uxNaziv = new System.Windows.Forms.TextBox();
			uxNazivLabel = new System.Windows.Forms.Label();
			this.uxPostanskiBroj = new System.Windows.Forms.TextBox();
			uxPostanskiBrojLabel = new System.Windows.Forms.Label();
			this.uxSifraOpcine = new System.Windows.Forms.TextBox();
			uxSifraOpcineLabel = new System.Windows.Forms.Label();
			this.uxPrirez = new System.Windows.Forms.TextBox();
			uxPrirezLabel = new System.Windows.Forms.Label();
			this.uxZiroRacunZaPorezPrirez = new System.Windows.Forms.TextBox();
			uxZiroRacunZaPorezPrirezLabel = new System.Windows.Forms.Label();
			this.uxTipMjesta = new System.Windows.Forms.ComboBox();
			uxTipMjestaLabel = new System.Windows.Forms.Label();
			this.uxIDNadMjesto = new System.Windows.Forms.ComboBox();
			uxIDNadMjestoLabel = new System.Windows.Forms.Label();
			this.uxHierarchy = new System.Windows.Forms.TextBox();
			uxHierarchyLabel = new System.Windows.Forms.Label();
			this.uxLvl = new System.Windows.Forms.TextBox();
			uxLvlLabel = new System.Windows.Forms.Label();
			this.uxSifraOpcineRegos = new System.Windows.Forms.TextBox();
			uxSifraOpcineRegosLabel = new System.Windows.Forms.Label();
			
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).BeginInit();
			this.SuspendLayout();
			
			// 
			// uxTableLayoutPanel
			// 
			//this.uxTableLayoutPanel.AutoSize = true;
			//this.uxTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
			//this.uxTableLayoutPanel.ColumnCount = 2;
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 120F));
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 250F));
			//this.uxTableLayoutPanel.Location = new System.Drawing.System.Drawing.Point(3, 3);
			//this.uxTableLayoutPanel.Name = "uxTableLayoutPanel";
			//this.uxTableLayoutPanel.RowCount = 2;
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.Size = new System.Drawing.Size(450, 50);
			//this.uxTableLayoutPanel.TabIndex = 0;
			
			//
			// uxErrorProvider
			//
			this.uxErrorProvider.ContainerControl = this;
			this.uxErrorProvider.DataSource = this.uxBindingSource;
			
			//
			// uxIDLabel
			//
			this.uxIDLabel.Text = "ID:";
			this.uxIDLabel.Location = new System.Drawing.Point(3, 0);
			this.Controls.Add(this.uxIDLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDLabel);			
			//
			// uxID
			//
			this.uxID.ReadOnly = true;
			//this.uxTableLayoutPanel.Controls.Add(this.uxID);
			this.uxID.Location = new System.Drawing.Point(160, 0);
			this.Controls.Add(this.uxID);
			//
			// uxNazivLabel
			//
			this.uxNazivLabel.Text = "Naziv:";
			this.uxNazivLabel.Location = new System.Drawing.Point(3, 26);
			this.Controls.Add(this.uxNazivLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxNazivLabel);			
			//
			// uxNaziv
			//
			this.uxNaziv.Width = 250;
			this.uxNaziv.MaxLength = 200;
			//this.uxTableLayoutPanel.Controls.Add(this.uxNaziv);
			this.uxNaziv.Location = new System.Drawing.Point(160, 26);
			this.Controls.Add(this.uxNaziv);
			//
			// uxPostanskiBrojLabel
			//
			this.uxPostanskiBrojLabel.Text = "PostanskiBroj:";
			this.uxPostanskiBrojLabel.Location = new System.Drawing.Point(3, 52);
			this.Controls.Add(this.uxPostanskiBrojLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxPostanskiBrojLabel);			
			//
			// uxPostanskiBroj
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxPostanskiBroj);
			this.uxPostanskiBroj.Location = new System.Drawing.Point(160, 52);
			this.Controls.Add(this.uxPostanskiBroj);
			//
			// uxSifraOpcineLabel
			//
			this.uxSifraOpcineLabel.Text = "SifraOpcine:";
			this.uxSifraOpcineLabel.Location = new System.Drawing.Point(3, 78);
			this.Controls.Add(this.uxSifraOpcineLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxSifraOpcineLabel);			
			//
			// uxSifraOpcine
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxSifraOpcine);
			this.uxSifraOpcine.Location = new System.Drawing.Point(160, 78);
			this.Controls.Add(this.uxSifraOpcine);
			//
			// uxPrirezLabel
			//
			this.uxPrirezLabel.Text = "Prirez:";
			this.uxPrirezLabel.Location = new System.Drawing.Point(3, 104);
			this.Controls.Add(this.uxPrirezLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxPrirezLabel);			
			//
			// uxPrirez
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxPrirez);
			this.uxPrirez.Location = new System.Drawing.Point(160, 104);
			this.Controls.Add(this.uxPrirez);
			//
			// uxZiroRacunZaPorezPrirezLabel
			//
			this.uxZiroRacunZaPorezPrirezLabel.Text = "ZiroRacunZaPorezPrirez:";
			this.uxZiroRacunZaPorezPrirezLabel.Location = new System.Drawing.Point(3, 130);
			this.Controls.Add(this.uxZiroRacunZaPorezPrirezLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxZiroRacunZaPorezPrirezLabel);			
			//
			// uxZiroRacunZaPorezPrirez
			//
			this.uxZiroRacunZaPorezPrirez.Width = 250;
			this.uxZiroRacunZaPorezPrirez.MaxLength = 50;
			//this.uxTableLayoutPanel.Controls.Add(this.uxZiroRacunZaPorezPrirez);
			this.uxZiroRacunZaPorezPrirez.Location = new System.Drawing.Point(160, 130);
			this.Controls.Add(this.uxZiroRacunZaPorezPrirez);
			//
			// uxTipMjestaLabel
			//
			this.uxTipMjestaLabel.Text = "TipMjesta:";
			this.uxTipMjestaLabel.Location = new System.Drawing.Point(3, 156);
			this.Controls.Add(this.uxTipMjestaLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxTipMjestaLabel);			
			//
			// uxTipMjesta
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxTipMjesta);
			this.uxTipMjesta.Location = new System.Drawing.Point(160, 156);
			this.Controls.Add(this.uxTipMjesta);
			//
			// uxIDNadMjestoLabel
			//
			this.uxIDNadMjestoLabel.Text = "IDNadMjesto:";
			this.uxIDNadMjestoLabel.Location = new System.Drawing.Point(3, 182);
			this.Controls.Add(this.uxIDNadMjestoLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDNadMjestoLabel);			
			//
			// uxIDNadMjesto
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDNadMjesto);
			this.uxIDNadMjesto.Location = new System.Drawing.Point(160, 182);
			this.Controls.Add(this.uxIDNadMjesto);
			//
			// uxHierarchyLabel
			//
			this.uxHierarchyLabel.Text = "Hierarchy:";
			this.uxHierarchyLabel.Location = new System.Drawing.Point(3, 208);
			this.Controls.Add(this.uxHierarchyLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxHierarchyLabel);			
			//
			// uxHierarchy
			//
			this.uxHierarchy.Width = 250;
			this.uxHierarchy.MaxLength = 200;
			//this.uxTableLayoutPanel.Controls.Add(this.uxHierarchy);
			this.uxHierarchy.Location = new System.Drawing.Point(160, 208);
			this.Controls.Add(this.uxHierarchy);
			//
			// uxLvlLabel
			//
			this.uxLvlLabel.Text = "Lvl:";
			this.uxLvlLabel.Location = new System.Drawing.Point(3, 234);
			this.Controls.Add(this.uxLvlLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxLvlLabel);			
			//
			// uxLvl
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxLvl);
			this.uxLvl.Location = new System.Drawing.Point(160, 234);
			this.Controls.Add(this.uxLvl);
			//
			// uxSifraOpcineRegosLabel
			//
			this.uxSifraOpcineRegosLabel.Text = "SifraOpcineRegos:";
			this.uxSifraOpcineRegosLabel.Location = new System.Drawing.Point(3, 260);
			this.Controls.Add(this.uxSifraOpcineRegosLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxSifraOpcineRegosLabel);			
			//
			// uxSifraOpcineRegos
			//
			this.uxSifraOpcineRegos.Width = 250;
			this.uxSifraOpcineRegos.MaxLength = 5;
			//this.uxTableLayoutPanel.Controls.Add(this.uxSifraOpcineRegos);
			this.uxSifraOpcineRegos.Location = new System.Drawing.Point(160, 260);
			this.Controls.Add(this.uxSifraOpcineRegos);
			//
			// uxIDNadMjesto
			//				
			this.uxIDNadMjesto.DisplayMember = "Naziv";	
			this.uxIDNadMjesto.ValueMember = "ID";	
			//
			// uxTipMjesta
			//				
			this.uxTipMjesta.DisplayMember = "Naziv";	
			this.uxTipMjesta.ValueMember = "ID";	
			// 
			// MjestoEditControlBase
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			//this.Controls.Add(this.uxTableLayoutPanel);
			this.AutoScroll = true;
			this.Name = "MjestoEditControlBase";
			this.Size = new System.Drawing.Size(478, 311);
			//this.Localizable = true;
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).EndInit();			
			this.ResumeLayout(false);
			this.PerformLayout();
		}
		#endregion
				
		#region ComboBox List
		
				
		private Entities.TList<Entities.Mjesto> _IDNadMjestoList;
		
		/// <summary>
		/// The ComboBox associated with the IDNadMjesto property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.Mjesto> IDNadMjestoList
		{
			get {return _IDNadMjestoList;}
			set 
			{
				this._IDNadMjestoList = value;
				this.uxIDNadMjesto.DataSource = null;
				this.uxIDNadMjesto.DataSource = value;
			}
		}
		
		private bool _allowNewItemInIDNadMjestoList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the IDNadMjesto property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDNadMjestoList
		{
			get { return _allowNewItemInIDNadMjestoList;}
			set
			{
				this._allowNewItemInIDNadMjestoList = value;
				this.uxIDNadMjesto.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
				
		private Entities.TList<Entities.MjestoTip> _TipMjestaList;
		
		/// <summary>
		/// The ComboBox associated with the TipMjesta property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.MjestoTip> TipMjestaList
		{
			get {return _TipMjestaList;}
			set 
			{
				this._TipMjestaList = value;
				this.uxTipMjesta.DataSource = null;
				this.uxTipMjesta.DataSource = value;
			}
		}
		
		private bool _allowNewItemInTipMjestaList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the TipMjesta property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInTipMjestaList
		{
			get { return _allowNewItemInTipMjestaList;}
			set
			{
				this._allowNewItemInTipMjestaList = value;
				this.uxTipMjesta.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	}
}
